<template>
	<div class="max">
		<my-header :backBtn="true">
			<div slot="right" @click="submit">
				保存
			</div>
		</my-header>
		<div class="cont-nof school-box tl">
			学校简介
			<div class="weui-cell my-weui-cell school-weui-cell">
				<div class="weui-cell__bd">
					<p class="my-textarea-p-long school-info" contenteditable="true" ref="textarea_cont"></p>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					brief: ''
				}
			}
		},
		methods: {
			submit() {
				let brief = this.$refs.textarea_cont.innerHTML;
				let data = {
					id: this.form.kindergartenId,
					brief: brief
				}
				//提交数据
				this.$http.updateKindergarten(data).then(resp => {
					this.$weui.toast('保存成功');
					this.queryFn();
				})
			},
			queryFn() {
				this.$http.fetchKindergarten().then(resp => {
					this.form = resp.data;
					this.$refs.textarea_cont.innerHTML = this.form.brief;
				})
			},

		},
		mounted() {
			this.queryFn();
		},
	}
</script>

<style scoped>
	.school-box {
		padding: 2rem 0.5rem;
		box-sizing: border-box;
	}

	.school-info {
		font-size: 1.4rem;
	}
</style>
